var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var BundleConfig = require("AA_BundleConfig");
var UIView = require("AA_UIView");
var UI_PlaerInfo_UIBindings = require("AA_UI_PlaerInfo_UIBindings");
var Excel = require("AA_Excel");
var BuffMag = require("AA_BuffMag");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_UI_PlaerInfo = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.auto_ui = null;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype._show = function (e) {
    var t = [];
    for (var o = 1; o < arguments.length; o++) {
      t[o - 1] = arguments[o];
    }
    var n = e;
    this.initInfo(n);
  };
  _creator.prototype.initInfo = function (e) {
    return __awaiter(this, undefined, undefined, function () {
      var t;
      var o;
      var n;
      var i;
      var a;
      var r;
      var c;
      var l;
      var d;
      var p;
      var f;
      var g;
      return __generator(this, function (s) {
        switch (s.label) {
          case 0:
            t = e.playerInfo.equipLevel;
            return [4, this._loadRes(BundleConfig.BundleNames.Common, "common/" + "res/player/player" + e.playerId + "_" + (t + 1), cc.SpriteFrame)];
          case 1:
            o = s.sent();
            this.auto_ui.sp_shuiguoimg.spriteFrame = o;
            n = BuffMag.BuffMgr.playAttackJiaCheng(e, e.sgattack, 1);
            i = BuffMag.BuffMgr.getAttackBaoJi(e, true);
            a = BuffMag.BuffMgr.playAttackJiaCheng(e, e.sgattackspeed, 2);
            this.auto_ui.txt_attacklb.string = "攻击力:" + n;
            this.auto_ui.txt_attackspeed.string = "攻速:" + a;
            this.auto_ui.txt_baoji.string = "暴击:" + 100 * (e.sgbaojia + i.baojijiacheng) + "%";
            this.auto_ui.txt_baojilv.string = "暴击率:" + 100 * (e.sgbaojilv + i.baojijilv) + "%";
            r = BuffMag.BuffMgr.getPlayerCiTiao(e);
            c = this.auto_ui.scroll_citiao.content;
            (l = c.children).forEach(function (e) {
              e.active = false;
            });
            for (d = 0; d < r.length; d++) {
              p = r[d];
              if (!(f = l[d])) {
                f = cc.instantiate(l[0]);
                c.addChild(f);
              }
              f.active = true;
              g = f.children[0].getComponent(cc.RichText);
              this.setCiTiaoContent(g, p);
            }
            return [2];
        }
      });
    });
  };
  _creator.prototype.setCiTiaoContent = function (e, t) {
    var o = t.citiaomiaoshu;
    var n = Excel.Excel.shuiguobuff(t.citiaoshuzhitype);
    var i = o.split("X");
    var a = "";
    for (var r = 0; r < i.length; r++) {
      var c = i[r];
      if (n.value[r]) {
        a += "<color=#ffffff>" + c + "</c><color=#00ff00>" + n.value[r] + "</color>";
      } else {
        a += "<color=#ffffff>" + c + "</c>";
      }
    }
    a = " <outline color=#000000>" + a + "</outline>";
    e.string = a;
  };
  _creator.prototype.onCloseView = function () {
    this._close();
  };
  __decorate([_property(UI_PlaerInfo_UIBindings.default)], _creator.prototype, "auto_ui", undefined);
  return __decorate([_ccclass], _creator);
}(UIView.default);
exports.default = _def_UI_PlaerInfo;